<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<style type="text/css">
div{width:200px; height:200px; background-color:red; position:absolute; left:200px; top:200px;}
</style>
</head>
<body>
<div id="div1"></div>
<script src="myJS.js"></script>
<script>
var arr = [];
for(var i=14;i>0;i-=2){
	arr.push(i,-i);
}
arr.push(0);
$("div1").bOn = true;
$("div1").onclick = function (){
	var that = this;
	if(that.bOn){
		that.bOn = false;
		var oldLeft = parseInt(getStyle(that,"left"));
		var i = 0;
		var timer = setInterval(function (){
			that.style.left = oldLeft+arr[i++]+"px";
			if(i===arr.length){
				clearInterval(timer);
				that.bOn = true;
			}
		},30)
	}
	
}
</script>
</body>
</html>
